Skip to content

Deprecated WithMinimumReadDBStatsInterval option#371

Open
tie wants to merge 1 commit into
nhatthm:masterfrom
tie:master
Open

Deprecated WithMinimumReadDBStatsInterval option#371
tie wants to merge 1 commit into
nhatthm:masterfrom
tie:master

Conversation

@tie
Copy link
Copy Markdown

@tie tie commented Sep 5, 2025

This option is not necessary since database/sql.DB.Stats calls are cheap. Note that go.opentelemetry.io/contrib/instrumentation/runtime instrumentation has a similar option WithMinimumReadMemStatsInterval, but for runtime.ReadMemStats that actually has a noticable performance impact (it does stopTheWorld to read stats).

database/sql.DB.Stats, on the other hand, simply acquires a mutex for a short duration to return a consistent snapshot of database statistics.

This option is not necessary since database/sql.DB.Stats calls are
cheap. Note that go.opentelemetry.io/contrib/instrumentation/runtime
instrumentation has a similar option WithMinimumReadMemStatsInterval,
but for runtime.ReadMemStats that actually has a noticable performance
impact (it does stopTheWorld to read stats).

database/sql.DB.Stats, on the other hand, simply acquires a mutex for a
short duration to return a consistent snapshot of database statistics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant